package syncmasterTesting;

import java.util.Random;

import syncmaster.BPMObserver;
import syncmaster.BeatObserver;
import syncmaster.RadarController;
import syncmaster.RadarModel;
import syncmaster.RadarModelInterface;
import junit.framework.TestCase;

public class radarTest extends TestCase {
	
	RadarModel model = new RadarModel();
	Random rand = new Random();
	int bpm = rand.nextInt((1000 - 0) + 1) + 0;
	RadarController controller = new RadarController(model);

	public void radarBPMSet(){
		model.setBPM(bpm);
	}
	
	public void testBPMSet(){
		radarBPMSet();
		TestCase.assertEquals(bpm, model.getBPM());
	}
	
	public void testHashGet(){
		TestCase.assertEquals(102, model.getHash());
	}
	
	public void controllerSet(){
		controller.setBPM(bpm);
	}
	
	public void controllerInc(){
		controller.increaseBPM();
	}
	
	public void controllerDec(){
		controller.decreaseBPM();
	}
	
	public void testController(){
		controllerSet();
		TestCase.assertEquals(bpm,model.getBPM());
		controllerSet();
		controllerInc();
		TestCase.assertEquals(bpm+1,model.getBPM());
		controllerSet();
		controllerDec();
		TestCase.assertEquals(bpm-1,model.getBPM());
	}
}
